-------------------------------------------------------------------------------
Sample Name: Stars (Virtual Night Sky) 

Description: Enter your latitude and longiture, current date and time, and 
	     watch how the sky looks like! It comes with a large star database 
             in text format, thus you just need to hover the mouse on a given 
             star and learn its name, brightness, distance, etc. VB Migration 
             Partner converts this sample flawlessly, after youve added a few 
             ReleaseHDc statement to deallocate the device context that was 
             grabbed by the hDC property. 

             The only (minor) difference from the original sample is that you 
             cant move your perspective by pressing Shift+left arrow (or 
             Shift+right arrow) because  quite oddly - these key combinations 
             arent trapped by the .NET PictureBox control, thus the converted 
             application uses the Alt+arrow key combination instead.


Download URL: http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=67371&lngWId=1
-------------------------------------------------------------------------------

IMPORTANT NOTE
The first step to ensure that you can migrate the VB6 project to VB.NET is 
loading the original project in the Visual Basic 6 IDE, run it to ensure that 
it works fine, that all the required type libraries are installed, and that all 
file paths are correct. 
Regardless of whether you edited the source code in any way, you should save 
the VB6 project: this save operation ensures that the .vbp file includes  
the correct path and version of referenced type libraries. 
After saving the project, it's usually a good idea to compile the VB6 project
to an executable, to detect any VB6 compilation errors that would appear under 
VB.NET as well. 
(If you don't recompile the project VB Migration Partner will display a warning 
when you later load the project.)


Only a few pragmas are required to correctly convert this sample to VB.NET.

1) add the following pragma at the top of the Stars.frm file
	'## AddDataFile StarData.txt

2) the code uses four BitBlt API methods for fast image copying. Each occurrence 
   of this method takes the hDC property of two PictureBox controls as its arguments, 
   therefore it is necessary to release the Hdc value. You can do it by means of the 
   ReleaseHDc method, which you insert via an InsertStatement pragma. Search for 
   "BitBlt" and append the pragma as shown below:

In DrawStars method:

	BitBlt Picture1.hDC, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, SwapScreen2.hDC, 0, 0, vbSrcCopy
	'## InsertStatement Picture1.ReleaseHDc(): SwapScreen2.ReleaseHDc()
	....
	BitBlt SwapScreen.hDC, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, Picture1.hDC, 0, 0, vbSrcCopy
	'## InsertStatement Picture1.ReleaseHDc(): SwapScreen.ReleaseHDc()

In Picture1_MouseDown method

        BitBlt Picture1.hDC, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, SwapScreen.hDC, 0, 0, vbSrcCopy
        '## InsertStatement Picture1.ReleaseHDc(): SwapScreen.ReleaseHDc()

In Picture1_MouseMove method

	BitBlt Picture1.hDC, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, SwapScreen.hDC, 0, 0, vbSrcCopy
	'## InsertStatement Picture1.ReleaseHDc(): SwapScreen.ReleaseHDc()

3) the original application uses the Shift+left and Shift+right key combinations to move 
   the point of view by five degrees. Unfortunately, the .NET PictureBox handles these 
   key combinations in a different way and translates them to Tab and Shift+Tab (they 
   move the focus to previous/next field). The VB.NET application should use a different 
   key combination, for example Alt+arrow. To enable this new key combination you need to 
   add a ParseReplace pragma inside the Picture1_KeyDown method:

	'## ParseReplace If Shift = 4 Then Inc = 5
	If Shift = 1 Then Inc = 5

